<!DOCTYPE html>
<html>
<head>
  <script src="../../processing.js"></script>
  <script src="../init.js"></script>
<link rel="stylesheet" href="../style.css"/></head>
<body><h1><a href="http://ejohn.org/blog/processingjs/">Processing.js</a></h1>
<h2>TileImages</h2>

<p>Draws an image larger than the screen by tiling it into small sections.
The scaleValue variable sets amount of scaling: 1 is 100%, 2 is 200%, etc.</p>

<p><a href="http://processing.org/learning/topics/tileimages.html"><b>Original Processing.org Example:</b> TileImages</a><br>
<script type="application/processing">
int scaleValue = 3;  // Multiplication factor
int xoffset = 0;     // x-axis offset
int yoffset = 0;     // y-axis offset

void setup() 
{
  size(600, 600);
  stroke(0, 100);
}

void draw() 
{
  scale(scaleValue);
  translate(xoffset *(-width / scaleValue), yoffset *(-height / scaleValue));
  line(10, 150, 500, 50);
  line(0, 600, 600, 0);
  setOffset();
}

void setOffset() 
{
  save("lines-" + xoffset + "-" + yoffset + ".jpg");
  xoffset++;
  if (xoffset == scaleValue) {
    xoffset = 0;
    yoffset++;
    if (yoffset == scaleValue) {
      exit();
    }
  }
  background(204);
}
</script><canvas width="200" height="200"></canvas></p>
<div style="height:0px;width:0px;overflow:hidden;"></div>

<pre><b>// All Examples Written by <a href="http://reas.com/">Casey Reas</a> and <a href="http://benfry.com/">Ben Fry</a>
// unless otherwise stated.</b>
int scaleValue = 3;  // Multiplication factor
int xoffset = 0;     // x-axis offset
int yoffset = 0;     // y-axis offset

void setup() 
{
  size(600, 600);
  stroke(0, 100);
}

void draw() 
{
  scale(scaleValue);
  translate(xoffset *(-width / scaleValue), yoffset *(-height / scaleValue));
  line(10, 150, 500, 50);
  line(0, 600, 600, 0);
  setOffset();
}

void setOffset() 
{
  save("lines-" + xoffset + "-" + yoffset + ".jpg");
  xoffset++;
  if (xoffset == scaleValue) {
    xoffset = 0;
    yoffset++;
    if (yoffset == scaleValue) {
      exit();
    }
  }
  background(204);
}</pre>
</body>
</html>
